//
//  UICollectionViewFlowLayout+MKUI.h
//  MKUI
//
//  Created by 苏尚进 on 2020/8/30.
//  Copyright © 2020 moon. All rights reserved.
//

#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
//声明集合布局具有计算自适应尺寸的能力
@protocol MKUICollectionViewLayoutSizeFitsProtocol <NSObject>
/// 指定collectionview的最大尺寸，返回collectionview最合适的尺寸值
/// @param size 外层最大尺寸
- (CGSize)mk_sizeThatFits:(CGSize)size;
@end

@interface UICollectionViewFlowLayout (MKUI)
@property(nonatomic,readonly,nullable)
id<UICollectionViewDelegateFlowLayout> mk_flowLayoutDelegate;
- (CGSize)mk_sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
- (UIEdgeInsets)mk_insetForSectionAtIndex:(NSInteger)index;
- (CGFloat)mk_minimumLineSpacingForSectionAtIndex:(NSInteger)index;
- (CGFloat)mk_minimumInteritemSpacingForSectionAtIndex:(NSInteger)index;
- (CGSize)mk_referenceSizeForFooterInSection:(NSInteger)index;
- (CGSize)mk_referenceSizeForHeaderInSection:(NSInteger)index;
- (CGRect)mk_contentBoundsForSectionAtIndex:(NSInteger)index;
@end

@interface UICollectionViewFlowLayout (MKUI_SizeFits)<MKUICollectionViewLayoutSizeFitsProtocol>
@end

@interface UICollectionView (MKUI_UICollectionViewFlowLayout)
@property(nonatomic,readonly,nullable) __kindof UICollectionViewFlowLayout *mk_collectionViewFlowLayout;
@end

NS_ASSUME_NONNULL_END
